package cn.e3.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.e3.content.service.ContentCategoryService;
import cn.e3.easyuitreenode.EasyuiTreeNode;
import cn.e3.utils.E3Result;

@Controller
public class ContentCategoryController {
	@Autowired
	private ContentCategoryService contentCategoryService;
	@RequestMapping("/content/category/list")
	@ResponseBody
	//查询分类节点数据
	public List<EasyuiTreeNode> getCategoryTreeNode(@RequestParam(name="id",defaultValue="0") Long parentId){
		List<EasyuiTreeNode> list = contentCategoryService.getContentCat(parentId);
		return list;
	}
	/*
	 * 增加节点数据
	 */
	@RequestMapping(value="/content/category/create",method=RequestMethod.POST)
	@ResponseBody
	public E3Result createCategory(Long parentId,String name){
		E3Result e3Result = contentCategoryService.createContentCategory(parentId, name);
		return e3Result;
	}
}
